;$Id: genlognormal.pro 4 2009-07-01 08:10:55Z dingyy.pku $
;+
; NAME: GENLOGNORMAL
; PURPOSE:
;   Generate log normal distribution
;-
pro GenLogNormal,n_r,r,N=N,d0=d0,Sigma=Sigma,size_r=size_r,xWidthRatio=xWidthRatio

  if (N_params() eq 0) then begin
    print,'Too Few Parameters!'
  endif else begin
    if ~KEYWORD_SET(size_r) then size_r=1000
    if ~KEYWORD_SET(xWidthRatio) then xWidthRatio=5
    if ~KEYWORD_SET(N) then N=100d
    if ~KEYWORD_SET(d0) then d0=0.04d
    if ~KEYWORD_SET(Sigma) then Sigma=1.5d
    
    logR=findgen(size_r)/size_r*2*Alog(Sigma)*xWidthRatio-Alog(Sigma)*xWidthRatio+Alog(d0)
    r=Exp(logR)
    n_r=LogNormal_r(N,d0,r,Sigma)
  endelse
end
